SysManager.UserGroup = function() {
	var accountGrid;
	var classhoursGrid;
	
	var loadUnitForm;
	var sysUnitPanel;

	var unitTab = new Ext.TabPanel({
		activeTab : 0,
		height : Ext.get("content").getHeight(),
		plain : false,
		frame : true,
		border : true,
		defaults : {
			autoScroll : true
		},
		items : [{
			id : 'unitTab',
			title : '单位信息',
			autoHeight : true,
			maskDisabled : false,
			//items : [unitForm],
			//listeners : {activate : loadUnitForm},
			buttonAlign : 'center',
			buttons : [{
						id : 'addButton',
						text : '添加'
						//,handler : addHandler
					}, {
						id : 'modifyButton',
						text : '编辑',
						hidden : true,
						handler : function() {
							unitForm.enable();
							hideButton();
						}// han
					}, {
						id : 'delButton',
						text : '删除',
						hidden : true
						//,handler : delHandler
					}, {
						id : 'saveButton',
						text : '保存',
						hidden : true,
						handler : function() {
							if (unitForm.getForm().isValid()) {
								unitForm.getForm().submit({
									url : '/sysunits.action?method=insertOrUpdateCode',
									waitMsg : '正在保存数据...',
									success : onAddSuccess,
									failure : onFailure
								});
							}
						}// eo handler
					}]
		}
		//, classhoursGrid
		//, accountGrid
		]
	});

	function initSysUnitpanel(treePanel) {
		sysUnitPanel = new Ext.Panel({
					layout : 'column',
					items : [{
								border : false,
								columnWidth : .2
								,items : [treePanel]
							}, {
								border : false,
								frame : true,
								columnWidth : .8
								,items : [unitTab]
							}]
				});
	};
	
	
	return {
		unitTree : new SysManager.UserGroup.UnitTree(),
		unitEdit : new SysManager.UserGroup.UnitEdit(),
		initialize : function(){
			currentUnit = null;
			this.unitTree.initialize();
			initSysUnitpanel(this.unitTree.getTreePanel());
			sysUnitPanel.render(Ext.get('content'));
		}
	};
	
};

